package com.lunwen.lunwen.services.impl;

import com.lunwen.lunwen.bean.MuBanRenWuJson;
import com.lunwen.lunwen.mapper.MuBanRenWuJsonMapper;
import com.lunwen.lunwen.services.MuBanRenWuJsonService;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

/**
 * (MuBanRenWuJson)表服务实现类
 *
 * @author makejava
 * @since 2020-08-03 21:41:06
 */
@Service
public class MuBanRenWuJsonServiceImpl implements MuBanRenWuJsonService {

    @Autowired
    private MuBanRenWuJsonMapper muBanRenWuJsonMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param mubanrenwuId 主键
     * @return 实例对象
     */
    @Override
    public MuBanRenWuJson queryById(String mubanrenwuId) {
        return this.muBanRenWuJsonMapper.queryById(mubanrenwuId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<MuBanRenWuJson> queryAllByLimit(Integer zhuangtai, int offset, int limit) {
        return this.muBanRenWuJsonMapper.queryAllByLimit(zhuangtai, offset, limit);
    }

    /**
     * 新增数据
     *
     * @param muBanRenWuJson 实例对象
     * @return 实例对象
     */
    @Override
    public MuBanRenWuJson insert(MuBanRenWuJson muBanRenWuJson) {
        this.muBanRenWuJsonMapper.insert(muBanRenWuJson);
        return muBanRenWuJson;
    }

    /**
     * 修改数据
     *
     * @param muBanRenWuJson 实例对象
     * @return 实例对象
     */
    @Override
    public MuBanRenWuJson update(MuBanRenWuJson muBanRenWuJson) {
        this.muBanRenWuJsonMapper.update(muBanRenWuJson);
        return this.queryById(muBanRenWuJson.getMubanrenwuId());
    }

    /**
     * 通过主键删除数据
     *
     * @param mubanrenwuId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String mubanrenwuId) {
        return this.muBanRenWuJsonMapper.deleteById(mubanrenwuId) > 0;
    }
}